package cn.snmp.mutual.data;
import cn.snmp.mutual.constants.SnmpConstante;

/**
 * @since 2018.9.16
 * @author dengkn
 * 错误记录ErrorObjService
 * 
 */
public class ErrorObjService extends ObjService {
	public ErrorObjService() {
		super(SnmpConstante.ERROR);
		this.setValue(SnmpConstante.ERRCODE, "0");
	}

	public ErrorObjService(String errCode, String errDesc, String errLevel) {
		super(SnmpConstante.ERROR);
		this.setValue(SnmpConstante.ERRCODE, errCode);
		this.setValue(SnmpConstante.ERRDESC, errDesc);
		this.setValue(SnmpConstante.ERRLEVEL, errLevel);
	}

	public void setErrCode(String errCode) {
		this.setValue(SnmpConstante.ERRCODE, errCode);
	}

	public int getErrCode() {
		return this.getIntValue(SnmpConstante.ERRCODE);
	}

	public void setErrDesc(String errDesc) {
		this.setValue(SnmpConstante.ERRDESC, errDesc);
	}

	public String getErrDesc() {
		return this.getStringValue(SnmpConstante.ERRDESC);
	}

	public void setErrLevel(String errLevel) {
		this.setValue(SnmpConstante.ERRLEVEL, errLevel);
	}

	public boolean hasMatchableCode(String errCode) {
		String value = this.getStringValue(SnmpConstante.ERRCODE);
		return errCode.equals(value);
	}

	public boolean hasMatchableCode(int errCode) {
		return this.hasMatchableCode(String.valueOf(errCode));
	}

	public int getErrLevel() {
		return this.getIntValue(SnmpConstante.ERRLEVEL);
	}

	public void setSubErrCode(String subErrCode) {
		this.setValue(SnmpConstante.SUBERRCODE, subErrCode);
	}

	public int getSubErrCode() {
		return this.getIntValue(SnmpConstante.SUBERRCODE);
	}
}